home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 23 / Amiga Format AFCD23 (Feb 1998, Issue 107).iso / -seriously_amiga- / shareware / programming / other / hunk / hoppers / amigae_32a.hop < prev    next >
Text File  |  1997-12-01  |  5KB  |  107 lines

  1. ;*************************************************************************
  2. ;** AmigaE 3.2a Div()/Mul() function                                    **
  3. ;** Contributor: L.Lucius                               Sept 23rd 1995  **
  4. ;** Modified for HOp:   Thomas Richter  (thor)          Nov  1st  1997  **
  5. ;** Function:    Modify 68000 math routines to use 68020+ instructions. **
  6. ;*************************************************************************
  7.  
  8.  
  9. ;*************************************************************************
  10. ;
  11. ; Div()
  12. ;
  13. #match
  14. #code
  15. 202F 0008                       ;   MOVE.L      0008(A7),D0
  16. 222F 0004                       ;   MOVE.L      0004(A7),D1
  17. 4A80                            ;   TST.L       D0
  18. 6B0C                            ;   BMI.B       0040
  19. 4A81                            ;   TST.L       D1
  20. 6A10                            ;   BPL.B       0048
  21. 4481                            ;   NEG.L       D1
  22. 610C                            ;   BSR.B       0048
  23. 4480                            ;   NEG.L       D0
  24. 4E75                            ;   RTS
  25. 4480                            ;   NEG.L       D0
  26. 4A81                            ;   TST.L       D1
  27. 6AF4                            ;   BPL.B       003A
  28. 4481                            ;   NEG.L       D1
  29. 4841                            ;   SWAP        D1
  30. 4A41                            ;   TST.W       D1
  31. 6620                            ;   BNE.B       006E
  32. 2F03                            ;   MOVE.L      D3,-(A7)
  33. 4841                            ;   SWAP        D1
  34. 3601                            ;   MOVE.W      D1,D3
  35. 3400                            ;   MOVE.W      D0,D2
  36. 4240                            ;   CLR.W       D0
  37. 4840                            ;   SWAP        D0
  38. 80C3                            ;   DIVU.W      D3,D0
  39. 2200                            ;   MOVE.L      D0,D1
  40. 4840                            ;   SWAP        D0
  41. 3202                            ;   MOVE.W      D2,D1
  42. 82C3                            ;   DIVU.W      D3,D1
  43. 3001                            ;   MOVE.W      D1,D0
  44. 4241                            ;   CLR.W       D1
  45. 4841                            ;   SWAP        D1
  46. 261F                            ;   MOVE.L      (A7)+,D3
  47. 4E75                            ;   RTS
  48. 4841                            ;   SWAP        D1
  49. 48E7 1800                       ;   MOVEM.L     D3-D4,-(A7)
  50. 741F                            ;   MOVEQ       #1F,D2
  51. 7600                            ;   MOVEQ       #00,D3
  52. 7800                            ;   MOVEQ       #00,D4
  53. E383                            ;   ASL.L       #1,D3
  54. E380                            ;   ASL.L       #1,D0
  55. E394                            ;   ROXL.L      #1,D4
  56. B881                            ;   CMP.L       D1,D4
  57. 6504                            ;   BCS.B       0088
  58. 9881                            ;   SUB.L       D1,D4
  59. 5283                            ;   ADDQ.L      #1,D3
  60. 51CA FFF0                       ;   DBF         D2,007A
  61. 2204                            ;   MOVE.L      D4,D1
  62. 2003                            ;   MOVE.L      D3,D0
  63. 4CDF 0018                       ;   MOVEM.L     (A7)+,D3-D4
  64. 4E75                            ;   RTS
  65. ;
  66. ;
  67. #replace
  68. 202F 0008                       ;   MOVE.L      0008(A7),D0
  69. 4C6F 0800 0004                  ;   DIVS.L      0004(A7),D0
  70. 4E75                            ;   RTS
  71. #end
  72.  
  73.  
  74.  
  75. ;*************************************************************************
  76. ;
  77. ; Mul()
  78. ;
  79. #match
  80. #code
  81. 2643                            ;   MOVEA.L     D3,A3
  82. 222F 0004                       ;   MOVE.L      0004(A7),D1
  83. 202F 0008                       ;   MOVE.L      0008(A7),D0
  84. 2400                            ;   MOVE.L      D0,D2
  85. 2600                            ;   MOVE.L      D0,D3
  86. C0C1                            ;   MULU.W      D1,D0
  87. 4843                            ;   SWAP        D3
  88. C6C1                            ;   MULU.W      D1,D3
  89. 4843                            ;   SWAP        D3
  90. 4243                            ;   CLR.W       D3
  91. D083                            ;   ADD.L       D3,D0
  92. 4841                            ;   SWAP        D1
  93. C4C1                            ;   MULU.W      D1,D2
  94. 4842                            ;   SWAP        D2
  95. 4242                            ;   CLR.W       D2
  96. D082                            ;   ADD.L       D2,D0
  97. 260B                            ;   MOVE.L      A3,D3
  98. 4E75                            ;   RTS
  99. ;
  100. ;
  101. #replace
  102. 202F 0008                       ;   MOVE.L      0008(A7),D0
  103. 4C2F 0000 0004                  ;   MULS.L      0004(A7),D0
  104. 4E75                            ;   RTS
  105. #end
  106.  
  107.